<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .demo{
            width: 200px;
            height: 200px;
            background-color: red;
        }
        .demo2{
            width: 200px;
            height: 200px;
            background-color: green;
        }
        /* 隐藏过渡1 */
        .one-leave{opacity: 1;}
        .one-leave-active{transition: opacity 2s;}
        .one-leave-to{opacity: 0;}
        /* 隐藏过渡2 */
        .two-leave{opacity: 1;}
        .two-leave-active{transition: opacity 1s;}
        .two-leave-to{opacity: 0;}
        /* 显示过渡1 */
        .one-enter{opacity: 0;}
        .one-enter-active{transition: opacity 6s;}
        .one-enter-to{opacity: 1;}
        /* 显示过渡2 */
        .two-enter{opacity: 0;}
        .two-enter-active{transition: opacity 1s;}
        .two-enter-to{opacity: 1;}
    </style>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <button v-on:click="hidden">隐藏</button>
        <button v-on:click="show">显示</button>
        <!-- 隐藏区域1的过渡 -->
        <transition name="one">
            <div v-show="status" class="demo"></div>
        </transition>
        <!-- 隐藏区域2的过渡 -->
        <transition name="two">
            <div v-show="status" class="demo2"></div>
        </transition>
    </div>
    <script>
        var app = new Vue({
            el:'#app',
            data:{
                status:true
            },
            methods:{
                hidden(){
                    this.status = false
                },
                show(){
                    this.status = true 
                }
            }
        })
    </script>
</body>
</html>